﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            List<Tuple<int,Window>> values = new List<Tuple<int, Window> >();
            values.Add(new Tuple<int, Window>(1,this));
            byte[] bytes = new byte[1024];
            var temp=  bytes.Concat(new byte[] {1,1,1,1,} );
            string sql = "select * from Stu";
            var ado= PlayNugetPackage.DBClass.ADOHelper.GetADO("server=.;database=Test;uid=sa;pwd=sa123", PlayNugetPackage.DBClass.DBType.SqlServer);//;TrustServerCertificate=true
            //var ds= ado.SelectBySql(sql);
            sql = "update Stu set ClassName=@par1 where Id=@par2";
            List<Tuple<string, object>> tuples = new List<Tuple<string, object>>();
            tuples.Add(new Tuple<string, object>("par1", 66));
            tuples.Add(new Tuple<string, object>("parw2", 5));
            var count=ado.ExecuteSqlUsePars(sql,tuples);
            //Task.Run( () => {
            //SpinWait.SpinUntil(() => { return false; }, 10000);
            Task.Run(async () => {

                while (true) 
                {
                    //SpinWait.SpinUntil(() => { return false; }, 10);
                    //await Task.Delay(10);
                    //Task.Yield();
                    //Thread.Sleep(10);
                    Console.WriteLine("qqqq");
                }
            });
            //this.DataContext
        }
    }
}